Hi PD community,
Iāve just picked up a project where Iād like one of my apps to trigger events and resolve alerts based on thresholds the app gets from looking at devices. However, Iām struggling to find how when hitting eventsv2 endpoint (https://events.pagerduty.com/v2/enqueue) the incident_key in the incident can be populated at time of creation? No matter where I put it in the parameters or payload, it always ends up as āNoneā in the subsequent incident. All the alerts subsequently created under incident contain the dedup_key, but, I want to be able to uniquely identify the incident based on my apps dedup_key I specify, without having to recurse all incidents associated alertsā¦
Heres an example taken from the class Iāve written - can you tell me where Iām going wrong?
def trigger(self, description, hostname, details, dedup_key=None):
data = json.dumps({
'routing_key' : SERVICE_KEY,
'event_action': 'trigger',
'incident_key' : 'my-identifiable-incident-key',
'dedup_key' : dedup_key,
'payload' : { 'summary' : description,
'custom_details': details,
'source' : hostname,
'severity' : 'error',
},
'client' : '%s running on %s' % (sys.argv[0], os.uname()[1]),
'client_url' : 'https://my.super.awesome.app.net',
})
r = requests.post('https://events.pagerduty.com/v2/enqueue',
headers=self.headers,
data=data,
)
return r
When setting dedup_key in the above, it is the dedup_key in the associated alert. But incident_key is always None in the incident. If I chose to POST āincident_keyā in the āpayloadā, incident_keyā never ends up in the actual āincident_keyā field when pulling back the incidents againā¦
Iāll happily use another (appropriate) customisable field if it can make it into incident at time of creation, but Iām wondering why this is the way it isā¦?
Cheers!
Sandy